package ControlLayer;

import ModelLayer.*;
import java.util.ArrayList;

/**
 * Write a description of class PersonHandler here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class PersonHandler
{
    private PersonContainer personContainer;
    public Person person;
    
    /**
     * Constructor for objects of class PersonHandler
     */
    public PersonHandler()
    {
        personContainer = PersonContainer.getInstance();
    }
    
    public boolean addPerson(Person person)
    {
        return personContainer.addPerson(person);
    }
    
    public Person findPerson(int id)
    {
        return personContainer.findPerson(id);
    }
    
    public Person findPersonByName(String name)
    {
        return personContainer.findPersonByName(name);
    }
    
    public void updatePerson(int id, String name, String address, int postalCode, String city, String phone)
    {
        findPerson(id).setName(name);
        findPerson(id).setAddress(address);
        findPerson(id).setPostalCode(postalCode);
        findPerson(id).setCity(city);
        findPerson(id).setPhone(phone);
    }
    
    public void deletePerson(int id)
    {
        personContainer.deletePerson(id);
    }    
}
